﻿Option Strict On
Option Explicit On
Option Infer On

Imports System
Imports System.Collections.Generic
Imports GenDotNet.Task.Common

Public Enum SpParameterDirection
   Unknown = 0
   [In]
   Out
   InOut
End Enum

Public Module SpParameterDirectionExtensions
   Public Function StringToDirection(ByVal direction As String) As SpParameterDirection
      If direction.EqualsIgnoreCase("In") Then
         Return SpParameterDirection.In
      ElseIf direction.EqualsIgnoreCase("Out") Then
         Return SpParameterDirection.Out
      ElseIf direction.EqualsIgnoreCase("InOut") Then
         Return SpParameterDirection.InOut
      Else
         Throw New ArgumentException("Type not found")
      End If
   End Function

   <System.Runtime.CompilerServices.Extension()> _
   Public Function Output(ByVal direction As SpParameterDirection) As String
      Select Case direction
         Case SpParameterDirection.In
            Return "In"
         Case SpParameterDirection.Out
            Return "Out"
         Case SpParameterDirection.InOut
            Return "InOut"
         Case Else
            Return "Unknown Direction"
      End Select
   End Function
End Module
